@extends('layouts._app')
@section('content')
    <body class="iframe-h">
    <div class="wrap-container email-wrap clearfix">
        <ul class="layui-fixbar">
            <li class="layui-icon layui-fixbar-top" id="layui-fixbar-top" onclick="topFunction()"
                style="display:none;">
            </li>
        </ul>
        <div class="row">
            <div class="email-edge col-lg-2">
                <dl class="email-folder" style="overflow:auto; width:100%;height: -webkit-fill-available;">
                    <dt>文件夹</dt>
                    @if(isset($res['app']))
                        @foreach($res['app'] as $value)
                            <dd>
                                <a href="{{route('system.log.index')}}?name={{$value['value']}}"
                                   title="{{$value['value']}}">
                                    <i class="iconfont">&#xe602;</i>{{sub($value['value'])}}
                                </a>
                                <button class="layui-btn  layui-btn-danger layui-btn-mini"
                                        style="float: right;margin: 4px;">
                                    {{$value['count']}}
                                </button>
                            </dd>
                        @endforeach
                    @endif
                </dl>
            </div>
            <div class="col-lg-10">
                <div class="email-content" style="overflow:auto; width:100%;height: -webkit-fill-available;">
                    @include('layouts._flash')
                    <div class="email-content-title layui-form">
                        <span class="write-title">{{$request['name']}} ({{$res['name']['count']}})</span>
                    </div>
                    <div class="email-tool-btn clearfix">
                        <div class="col-lg-6 email-tool-btn-left">
                            <a class="layui-btn layui-btn-small layui-btn-primary" id='email-refresh-btn'
                               href="{{route('system.log.index')}}?name={{$request['name']}}" data-title='刷新'>
                                <i class="layui-icon">&#x1002;</i>
                            </a>
                        </div>
                    </div>
                    <div class="layui-form email-list">
                        <table class="layui-table">
                            <thead>
                            <tr>
                                <th>路径</th>
                                <th>名称</th>
                                <th>详情</th>
                            </tr>
                            </thead>
                            <tbody>
                            @foreach($res['pic'] as $value)
                                <tr>
                                    <td title="{{$value['name']}}">{{sub($value['name'])}}</td>
                                    <td>
                                        <a href="{{route('system.log.edit')}}?name={{$request['name']}}&
                                    static={{$request['static']}}&title={{$value['name'].$value['title']}}&filter=true"
                                           title="{{$value['title']}}">{{sub($value['title'],30)}}</a>
                                    </td>
                                    <td>
                                        <a href="{{route('system.log.edit')}}?name={{$request['name']}}&
                                    static={{$request['static']}}&title={{$value['name'].$value['title']}}&filter=true">
                                            查看内容
                                        </a>
                                    </td>
                                </tr>
                            @endforeach
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <script src="{{asset('static/admin/layui/layui.js')}}" type="text/javascript" charset="utf-8"></script>
    <script src="{{asset('static/admin/js/common.js')}}" type="text/javascript" charset="utf-8"></script>
    <script src="{{asset('js/jquery.min.js')}}" type="text/javascript" charset="utf-8"></script>
    <script>
        function topFunction() {
            $(".email-content").animate({scrollTop: 0}, "slow");
            $('#layui-fixbar-top').attr('style', 'display:none;');
        }

        function scrollFun() {
            var layuiBodyScrollTop = document.getElementsByClassName('email-content')[0].scrollTop;
            if (layuiBodyScrollTop > 200) {
                document.getElementById("layui-fixbar-top").style.display = "block";
            } else {
                document.getElementById("layui-fixbar-top").style.display = "none";
            }
        }

        /*注册事件*/
        if (document.addEventListener) {
            document.addEventListener('DOMMouseScroll', scrollFun, false);
        }//W3C
        window.onmousewheel = document.onmousewheel = scrollFun;//IE/Opera/Chrome

        //非手机端，设置高度
        if (window.innerWidth >= 768) {
            $('.email-content').css('height', window.innerHeight - 30);
        }
        $(window).resize(function () {
            $('.email-content').css('height', window.innerHeight - 30);
        });
    </script>
    </body>
@endsection
